package com.example.yunnan.service;

import com.example.yunnan.dao.announcementDao;
import com.example.yunnan.pojo.announcement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class announcementService {
    @Autowired
    announcementDao announcementDao;


    public List<announcement> list() {
        Sort sort = new Sort(Sort.Direction.ASC, "id");
        return announcementDao.findAll(sort);
    }

    public void addOrUpdate(announcement announcement) {
        announcementDao.save(announcement);
    }



}

